﻿using System;
using System.Collections.Generic;
using GC_FFW.BusinessEntities.Abstractions.Interfaces.Soccerfame;
using GC_FFW.SoccerfameParser.Abstractions.Interfaces.Helpers;
using HtmlAgilityPack;

namespace GC_FFW.SoccerfameParser.Abstractions.Managers
{
	public abstract class HtmlDocumentBaseManager
	{
		#region Protected Properties

		protected WebPageBaseManager WebPageManager { get; private set; }

		protected IStringManager StringManager { get; private set; }

		#endregion

		#region Constructors

		protected HtmlDocumentBaseManager(WebPageBaseManager webPageManager, IStringManager stringManager)
		{
			if (webPageManager == null)
				throw new ArgumentNullException(string.Format("web Page Manager"));
			WebPageManager = webPageManager;

			if (stringManager == null)
				throw new ArgumentNullException(string.Format("string Manager"));
			StringManager = stringManager;
		}

		#endregion

		#region Abstrct Methods

		public abstract HtmlDocument CreateHtmlDocument(string url);

		public abstract IHyperlink GetHyperlink(HtmlNode htmlNode);

		public abstract string GetFullInnerTextString(HtmlNode htmlNode);

		public abstract IEnumerable<HtmlNode> FindNodesByPartId(HtmlNode htmlNode, string partId);

		public abstract void ReqursiveScanNodesByPartId(HtmlNodeCollection nodeCollection, Action<HtmlNode> findNodeAction,
			string partId);

		public abstract IEnumerable<HtmlNode> FindNodesByAttributeValue(HtmlNode htmlNode, string attributeName, string attributeValue, bool isPartValue = false,
			IEnumerable<string> badPartValues = null);

		public abstract void ReqursiveScanNodesByAttributeValue(HtmlNodeCollection nodeCollection, Action<HtmlNode> findNodeAction,
			string attributeName, string attributeValue, bool isPartValue = false, IEnumerable<string> badPartValues = null);

		public abstract DateTime GetInnerTextDateTime(HtmlNode htmlNode);

		public abstract int GetInnerTextInt(HtmlNode htmlNode);

		#endregion
	}
}
